package com.suypower.carManage.action;

import javax.servlet.ServletException;

import com.jarp.db.DAO;
import com.opensymphony.xwork2.ActionSupport;
import com.suypower.carManage.comm.ConstUtil;

public class FeeAction extends ActionSupport{

	private String id;
	private String car_code;
	private String money;
	private String remark;
        private String fee_date;
	
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getCar_code() {
		return car_code;
	}
	public void setCar_code(String carCode) {
		car_code = carCode;
	}
	public String getMoney() {
		return money;
	}
	public void setMoney(String money) {
		this.money = money;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}

    public String getFee_date() {
        return fee_date;
    }

    public void setFee_date(String fee_date) {
        this.fee_date = fee_date;
    }
        
	
	
	public String execute(){
		String res="";
		DAO dao = new DAO();
		String sql="";
		if(id!=null&&!id.equals("")){
			sql="UPDATE tb_fee SET car_code='"+car_code+"',money='"+money+"',remark='"+remark+"',fee_date='"+fee_date+"' WHERE id="+id;
		}else{
			sql = "INSERT INTO tb_fee(car_code,money,fee_date,remark)VALUES('"
				+ car_code
				+ "','"
				+ money
				+ "','"
                                + fee_date
				+ "','"
				+ remark
				+"')";
		}
		 
		int count=0;
		try {
			count=dao.execCommand(ConstUtil.DBNAME, sql);
			if(count>0){
				res=this.SUCCESS;
			}else{
				res=this.ERROR;
			}
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return res;
	}
}
